home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2614.ZIP
/
50ERRS.ZIP
/
S87DEMO.PRG
next >
Wrap
Text File
|
1990-10-05
|
4KB
|
151 lines
/**************************************************************************
*
* Module name:
*
* S87Demo.PRG
*
* What it does:
*
* This program allows you to generate an error for each of the
* six (6) error UDF()s in the Summer '87 ErrorSys.PRG. It is
* useful in demonstrating how to use the S87ErMap() routine that
* re-packages Clipper 5.0 Error Handling conventions to those
* compatible with Summer '87.
*
* How to compile it:
*
* Clipper S87Demo
*
* How to link it:
*
* RTLINK fi S87Demo,S87ErMap,S87ErSys out S87Demo
*
* Note: S87ErSys.PRG is a copy of Summer '87 stock ErrorSys.PRG.
* It is included in this distribution as a convenience. It
* is renamed S87ErSys.PRG in order not to conflict with your
* own copy of ErrorSys.PRG in the same subdirectory.
*
* To request Summer '87 Error Handling at run-time:
*
* SET ERRORSYS=S87
*
* To request Clipper 5.0 Error Handling at run-time:
*
* SET ERRORSYS=5.0 (default)
*
* Written by:
*
* Philip H. Schwartz
* Vertical Management Systems, Inc.
* POB 90243
* Gainesville, FL 32607
* Compuserve: 72537,3261
*
* Written on:
*
* June 3, 1990 (for Palm Desert DevCon)
*
* Last updated on:
*
* October 5, 1990 (for Orlando Devcon)
*
* Rights:
*
* (c) 1990 Philip H. Schwartz
*
* Release:
*
* Written for tutorial purposes and non-commercial distribution
* rights assigned to Clipper developer community. May be distributed
* in this form without charge. Commercial and publishing rights
* reserved.
*
* Warranty:
*
* None.
*
* Comments:
*
* Additional material (text and code) will be available
* in a forthcoming monograph on the Clipper 5.0 Error System
* and in a series of Nantucket News articles.
*
**************************************************************************/
LOCAL aErrors := ;
{ "? UnknownVar Undef_error - Variable does not exist", ;
"USE missing.XYZ Open_error - Open error", ;
"? 2 + '7' Expr_error - Argument error", ;
"? SQRT('9') Expr_error - Argument error", ;
"? VAL(9) Expr_error - Argument error", ;
"c:\this\does\not\exist DB_error - Create error", ;
"Printer not ready Print_error - Printer error", ;
"USE S87Demo.EXE Misc_error - Corruption detected" }
LOCAL nErrType := 1
/***
* The following line calls the mapping routine that re-packages
* the Clipper 5.0 Error Object to the Summer '87 error UDF()s.
*/
S87ErrorSys()
/***
* This test program sets up several error conditions to
* demonstrate how the mapping routine works.
*
* Use the DOS SET ERRORSYS= command to select either Clipper 5.0
* or Summer '87 Error Handling conventions.
*/
CLS
@ 1, 0 TO 14, 72
@ 2, 1 SAY "ERROR HANDLING CONVENTIONS SELECTED: " + ;
IF( "S87" $ UPPER( GETE( "ERRORSYS" ) ), ;
"SUMMER '87", "CLIPPER 5.0" )
@ 3, 0 SAY CHR(195) + REPLICATE( CHR(196), 71 ) + CHR(180)
@ 4, 1 SAY ;
"Reason for error S'87 UDF() Clipper 5.0 Error Description"
@ 5, 0 SAY CHR(195) + REPLICATE( CHR(196), 71 ) + CHR(180)
nErrType := ACHOICE( 6, 1, 13, 71, aErrors )
CLS
DO CASE
CASE nErrType == 1 // Error - Variable does not exist
? unkn
CASE nErrType == 2 // Error - Open error
USE missing.XYZ
CASE nErrType == 3 // Error - Argument error
? 2 + "7"
CASE nErrType == 4 // Error - Argument error
? SQRT("9")
CASE nErrType == 5 // Error - Argument error
? VAL(9)
CASE nErrType == 6 // Error - Create error
SET ALTERNATE TO c:\this\does\not\exist
SET ALTERNATE ON
SET ALTERNATE OFF
SET ALTERNATE TO
CASE nErrType == 7 // Error - Printer error
? "Please turn your printer OFF or set it OFFLINE"
? "Press SPACE BAR when this is done"
INKEY(0)
EJECT
CASE nErrType == 8 // Error - Corruption detected
USE S87Demo.EXE // Trying to open the EXE file as
// a DBF should do it!
ENDCASE
RETURN
/*eof*/